using FireStarterModeller.BO;
using Habanero.BO;

namespace Firestarter.DB.Schema.Logic
{
    public class DBDataTypeMappingSQLite : IDBDataTypeMapping
    {
        public BusinessObjectCollection<TypeMapping> GetDefaultTypeMappings()
        {
            // Indicates how the DB-specific data type on the left matches to
            //  the generic data type on the right
            string[,] mappings = {
                                     //FromType, ToType
                                     {"bit", DBDataTypes.BIT},
                                     {"timestamp", DBDataTypes.TIMESTAMP},
                                     {"binary", DBDataTypes.BINARY},
                                     {"image", DBDataTypes.BINARY},
                                     {"varbinary", DBDataTypes.VARBINARY},
                                     {"datetime", DBDataTypes.DATETIME},
                                     {"smalldatetime", DBDataTypes.DATETIME},
                                     {"money", DBDataTypes.DECIMAL},
                                     {"smallmoney", DBDataTypes.DECIMAL},
                                     {"decimal", DBDataTypes.DECIMAL},
                                     {"numeric", DBDataTypes.NUMERIC},
                                     {"float", DBDataTypes.DOUBLE},
                                     {"uniquedientifier", DBDataTypes.UNIQUEIDENTIFIER},
                                     {"smallint", DBDataTypes.SMALLINT},
                                     {"int", DBDataTypes.INTEGER},
                                     {"bigint", DBDataTypes.BIGINT},
                                     {"sql_variant", DBDataTypes.VARCHAR},
                                     {"tinyint", DBDataTypes.TINYINT},
                                     {"real", DBDataTypes.SINGLE},
                                     {"text", DBDataTypes.TEXT},
                                     {"ntext", DBDataTypes.TEXT},
                                     {"xml", DBDataTypes.TEXT},
                                     {"varchar", DBDataTypes.VARCHAR},
                                     {"char", DBDataTypes.CHAR},
                                     {"nchar", DBDataTypes.CHAR},
                                     {"nvarchar", DBDataTypes.VARCHAR},
                                     //{"?", "TIME"}

                                 };
            BusinessObjectCollection<TypeMapping> standardTypeMappings = new BusinessObjectCollection<TypeMapping>();
            for (int pairNum = 0; pairNum < mappings.Length / 2; pairNum++)
            {
                standardTypeMappings.Add(new TypeMapping { FromType = mappings[pairNum, 0], ToType = mappings[pairNum, 1] });
            }
            return standardTypeMappings;
        }
    }
}